package stringExample;

public class Main {
	public static void main(String[] args) {
		createString();
		stringEqual();
	}

	private static void stringEqual() {
		//new String("123").equals("123");  //true为相等
		//new String("123").compareTo("123");  //0为相等
	}

	private static void createString() {
		//1. string作为参数
		String cat = new String("cat");
		char[] chars = new char[]{1, 2, 3};
		//2. 利用 char[] 来做
		String charsString = new String(chars);
		StringBuffer stringBuffer = new StringBuffer("bufferStr");
		//3. 利用stringBuffer为参数
		String bufferString = new String(stringBuffer);
		StringBuilder builderStr = new StringBuilder("builderStr");
		//4. 利用stringBuilder 来做参数
		String stringBuilder = new String(builderStr);
	}
}
